import '../page/Form.dart';
import 'package:flutter/material.dart';
import '../page/Search.dart';
import '../page/Tabs.dart';
import '../page/Product.dart';
import '../page/ProductInfo.dart';
import '../page/user/Login.dart';
import '../page/user/RegisterFirst.dart';
import '../page/user/RegisterSecond.dart';
import '../page/user/RegisterThird.dart';
import '../page/appBarCustom.dart';
import '../page/TabbarController.dart';
import '../page/drawer/drawerUser.dart';
import '../page/checkbox_radio_textfield/button/RaisedButtonDemo.dart';
import '../page/checkbox_radio_textfield/TextFieldpage/TextFieldPage.dart';
import '../page/checkbox_radio_textfield/checkBox/CheckBoxPage.dart';
import '../page/checkbox_radio_textfield/Radio/RadioPage.dart';
import '../page/checkbox_radio_textfield/demoPage.dart';
import '../page/timeview/fluttertimePage.dart';
import '../page/timeview/timeotherPage.dart';
import '../page/flutterSwiper/SwiperPage.dart';
import '../page/flutterdialog/DialogPage.dart';
import '../page/flutterhttp/http.dart';
import '../page/flutterhttp/dioHttpDemo.dart';
import '../page/yanshi/ListViewDemo.dart';
import '../CardLayout.dart';
import '../GridViewbuilder.dart';
import '../GridViewcount.dart';
import '../WrapLayout.dart';
import '../ChangeTextColor.dart';
import '../ExpandedLayout.dart';


//配置路由
final routes = {
  '/': (context) => Tabs(),
  '/product': (context) => ProductPage(),
  '/productInfo': (context, {arguments}) =>
      ProductInfoPage(arguments: arguments),
  '/form': (context) => FormPage(),
  '/search': (context, {arguments}) => SerarchPage(arguments: arguments),
  '/login': (context) => LoginPage(),
  '/registerFirst': (context) => RegisterFirstPage(),
  '/registerSecond': (context) => RegisterSecondPage(),
  '/registerThird': (context) => RegisterThirdPage(),
  '/appBarCustom': (context) => AppBarCustom(),
  '/tabbarController': (context) => TabbarControllerPage(),
  '/drawerUser': (context) => DrawerUserPage(),
  '/button': (context) => RaisedButtonPage(),
  '/textFieldPage': (context) => TextFieldPage(),
  '/checkBox': (context) => CheckBoxPage(),
  '/radio': (context) => RadioPage(),
  '/demoPage': (context) => DemoPage(),
  '/fluttertime': (context) => FlutterTimePage(),
  '/timeother': (context) => TimeOtherPage(),
  '/swiper': (context) => SwiperPage(),
  '/dialog': (context) => DialogPage(),
  '/http': (context) => HttpPage(),
  '/dioHttpDemo': (context) => HttpDemoPage(),
  '/ListViewDemoPage': (context) => ListViewDemoPage(),
  '/card': (context) => CardLayout(),
  '/gridViewbuilder': (context) => GridViewbuilder(),
  '/gridViewcount': (context) => GridViewcount(),
  '/wrap': (context) => WrapLayout(),
  '/changeTextColor': (context) => ChangeTextColor(),
'/expandedLayout': (context) => ExpandedLayout(),

  
};
// 固定写法
var onGenerateRoute = (RouteSettings settings) {
  //统一处理
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =
          MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};
